from xpinyin import Pinyin
import re

def DBC2SBC(ustring):
    # 全角转半角
    rule = re.compile("[^a-zA-Z0-9\u4e00-\u9fa5]")
    rstring = rule.sub('',ustring)
    return rstring

def chinese2pinyin(chinese):
    p = Pinyin().get_pinyin(chinese)
    return DBC2SBC(p)
    # return p.replace('-', '').replace('。', '').replace('，','').replace('“','').replace('”','').replace("‘",'').replace("’",'')

